package se.cbb.scripts;

import java.io.BufferedReader;
import java.io.FileReader;
import java.util.ArrayList;

import se.cbb.misc.Sequence;
import se.cbb.misc.SequenceFileWriter;
import se.cbb.misc.SimpleFileIO;

public class VMCMCParallelEstimator {

	public static void main(String[] args) {
		try {
			String path = "/Users/rhali/Desktop/simRun4/";
			String str;
//			
			
			BufferedReader bufferedreader = new BufferedReader(new FileReader("/Users/rhali/Desktop/FileNames.txt"));
			while ((str = bufferedreader.readLine()) != null) {
				int index = 0;
				BufferedReader bufferedreader1 = new BufferedReader(new FileReader(path + str + ".par"));
				SequenceFileWriter.writeAndAppendString(path, "Results.txt", str + "\t");
				while ((str = bufferedreader1.readLine()) != null) {
					index++;
//					SequenceFileWriter.writeAndAppendLine(path, "ParallelAnalysis.sh", "java -Xmx3600m -Xms3200m -jar VMCMC-1.0.0.jar ./Informed/MCMC/InformedGeneTree" + str + ".mcmc ./Uninformed/MCMC/GeneTree" + str + ".mcmc -o " + str + ".par -b1 0 -b2 0");
					if(index == 12 || index == 17 || index == 22 || index == 27 || index == 32 || index == 37 || index == 42 || index == 47 ) {
						String[] strArr = str.split(":");
						SequenceFileWriter.writeAndAppendString(path, "Results.txt", strArr[1].substring(1) + "\t");
					}
				}
				SequenceFileWriter.writeAndAppendString(path, "Results.txt", "\n");
				bufferedreader1.close();
//				index++;
			}
			
			bufferedreader.close();
		} catch (Exception e) {
			System.out.println("Error : " + e.getMessage());
		}


	}

}
